package reflect;

import java.lang.reflect.Constructor;

public class TestDemo {
    public static void main(String[] args) throws  Exception{
        Class cls = Class.forName("reflect.Student");
        Object obj = cls.newInstance();
        System.out.println(obj);
        System.out.println("--------------------------------");
        Constructor c = cls.getConstructor();
        Object obj1 = c.newInstance();
        System.out.println(obj1);

        Constructor c2 = cls.getConstructor(String.class,int.class,char.class);
        Object obj2 = c2.newInstance("李四",29,'男');
        System.out.println(obj2);


    }
}
